﻿Public Class BooleanToTextConverter
    Implements IValueConverter

    Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        If TypeOf (value) Is Boolean Then
            Dim b = DirectCast(value, Boolean)
            If b Then
                Return Application.Current.Resources("resStopWork")
            Else
                Return Application.Current.Resources("resStartWork")
            End If
        End If
        Return Application.Current.Resources("resStopWork")
    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        If value.Equals(Application.Current.Resources("resStopWork")) Then
            Return True
        Else
            Return False
        End If
    End Function
End Class
